/* 
 * Copyright [2018] [Alex/libo(liboms@hotmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.apidoc.javadoc;

import java.util.List;
import java.util.Objects;

import com.hyts.apidoc.config.ApiDocConfig;
import com.sun.tools.javadoc.Main;

/** 
 * @title JavaDocSupport.java  
 * @package com.hyts.apidoc.javadoc  
 * @description sun 官方支持的javadoc操作进行控制
 * 				javadoc的读取以及抽取实现方法，此处为支持系统操作
 * 				控制工具  
 * @see TODO
 * @author libo/Alex
 * @email liboms@hotmail.com/liboware@163.com  
 * @date 2018年4月23日 
 * @version V1.0 
 */
public final class JavaDocSupport {
	/**  
	 * <b>buildJavaDocParam</b>
	 * <p>构建javadoc参数信息帮助类</p>
	 * @param paramList
	 * @return String[] 字符串数组结果集合
	 * @exception
	 */ 
	public static boolean buildJavaDocParam(List<String> paramList){
		if(Objects.isNull(paramList) || paramList.isEmpty()) {
			return false;
		}
		try {
			paramList.add(0,ApiDocConfig.DEFAULT_SUN_JAVA_DOC);//Doclet方式解析Javadoc方案
			paramList.add(1,ApiDocConfig.DEFAULT_JAVA_DOC_HANDLER);//处理Javadoc操作句柄服务
			String[] results = paramList.toArray(new String[paramList.size()]);
			Main.execute(results);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}
}
